// 种族初始属性
export const init_attribute = {
    "人": [10, 10, 10, 10, 10],
    "魔": [12, 11, 11, 8, 8],
    "仙": [12, 5, 11, 12, 10],
}

//角色枚举信息
export const characters_enum_data = {
    "玄彩娥": {
        "染色方案": 12,
        "性别": "女",
        "武器": [
            "飘带",
            "魔棒"
        ],
        "种族": "仙",
        "门派": [
            "天宫",
            "普陀山",
            "龙宫",
            "凌波城",
            "花果山"
        ],
        "模型": "玄彩娥",
        "ID": 12
    },
    "逍遥生": {
        "染色方案": 1,
        "性别": "男",
        "武器": [
            "扇",
            "剑"
        ],
        "种族": "人",
        "门派": [
            "大唐官府",
            "化生寺",
            "方寸山",
            "神木林"
        ],
        "模型": "逍遥生",
        "ID": 4
    },
    "神天兵": {
        "染色方案": 9,
        "性别": "男",
        "武器": [
            "锤",
            "枪矛"
        ],
        "种族": "仙",
        "门派": [
            "天宫",
            "五庄观",
            "龙宫",
            "凌波城",
            "花果山"
        ],
        "模型": "神天兵",
        "ID": 14
    },
    "龙太子": {
        "染色方案": 10,
        "性别": "男",
        "武器": [
            "扇",
            "枪矛"
        ],
        "种族": "仙",
        "门派": [
            "天宫",
            "五庄观",
            "龙宫",
            "凌波城",
            "花果山"
        ],
        "模型": "龙太子",
        "ID": 15
    },
    "桃夭夭": {
        "染色方案": 204,
        "性别": "女",
        "武器": [
            "灯笼"
        ],
        "种族": "仙",
        "门派": [
            "天宫",
            "普陀山",
            "龙宫",
            "凌波城",
            "花果山"
        ],
        "模型": "桃夭夭",
        "ID": 16
    },
    "狐美人": {
        "染色方案": 7,
        "性别": "女",
        "武器": [
            "爪刺",
            "鞭"
        ],
        "种族": "魔",
        "门派": [
            "盘丝洞",
            "阴曹地府",
            "魔王寨",
            "无底洞"
        ],
        "模型": "狐美人",
        "ID": 6
    },
    "偃无师": {
        "染色方案": 205,
        "性别": "男",
        "武器": [
            "剑",
            "巨剑"
        ],
        "种族": "人",
        "门派": [
            "大唐官府",
            "化生寺",
            "方寸山",
            "神木林"
        ],
        "模型": "偃无师",
        "ID": 17
    },
    "鬼潇潇": {
        "染色方案": 206,
        "性别": "女",
        "武器": [
            "爪刺",
            "伞"
        ],
        "种族": "魔",
        "门派": [
            "盘丝洞",
            "阴曹地府",
            "魔王寨",
            "无底洞"
        ],
        "模型": "鬼潇潇",
        "ID": 18
    },
    "飞燕女": {
        "染色方案": 3,
        "性别": "女",
        "武器": [
            "双剑",
            "环圈"
        ],
        "种族": "人",
        "门派": [
            "大唐官府",
            "女儿村",
            "方寸山",
            "神木林"
        ],
        "模型": "飞燕女",
        "ID": 1
    },
    "影精灵": {
        "染色方案": 8,
        "性别": "女",
        "武器": [
            "魔棒",
            "爪刺"
        ],
        "种族": "魔",
        "门派": [
            "盘丝洞",
            "阴曹地府",
            "魔王寨",
            "无底洞",
            "九黎城"
        ],
        "模型": "影精灵",
        "ID": 19
    },
    "骨精灵": {
        "染色方案": 8,
        "性别": "女",
        "武器": [
            "魔棒",
            "爪刺"
        ],
        "种族": "魔",
        "门派": [
            "盘丝洞",
            "阴曹地府",
            "魔王寨",
            "无底洞"
        ],
        "模型": "骨精灵",
        "ID": 7
    },
    "杀破狼": {
        "染色方案": 202,
        "性别": "男",
        "武器": [
            "宝珠",
            "弓弩"
        ],
        "种族": "魔",
        "门派": [
            "狮驼岭",
            "阴曹地府",
            "魔王寨",
            "无底洞"
        ],
        "模型": "杀破狼",
        "ID": 8
    },
    "巨魔王": {
        "染色方案": 5,
        "性别": "男",
        "武器": [
            "刀",
            "斧钺"
        ],
        "种族": "魔",
        "门派": [
            "狮驼岭",
            "阴曹地府",
            "魔王寨",
            "无底洞"
        ],
        "模型": "巨魔王",
        "ID": 9
    },
    "虎头怪": {
        "染色方案": 6,
        "性别": "男",
        "武器": [
            "斧钺",
            "锤子"
        ],
        "种族": "魔",
        "门派": [
            "狮驼岭",
            "阴曹地府",
            "魔王寨",
            "无底洞"
        ],
        "模型": "虎头怪",
        "ID": 10
    },
    "舞天姬": {
        "染色方案": 11,
        "性别": "女",
        "武器": [
            "飘带",
            "环圈"
        ],
        "种族": "仙",
        "门派": [
            "天宫",
            "普陀山",
            "龙宫",
            "凌波城",
            "花果山"
        ],
        "模型": "舞天姬",
        "ID": 11
    },
    "羽灵神": {
        "染色方案": 203,
        "性别": "男",
        "武器": [
            "法杖",
            "弓弩"
        ],
        "种族": "仙",
        "门派": [
            "天宫",
            "普陀山",
            "龙宫",
            "凌波城",
            "花果山"
        ],
        "模型": "羽灵神",
        "ID": 13
    },
    "英女侠": {
        "染色方案": 4,
        "性别": "女",
        "武器": [
            "双剑",
            "鞭"
        ],
        "种族": "人",
        "门派": [
            "大唐官府",
            "女儿村",
            "方寸山",
            "神木林"
        ],
        "模型": "英女侠",
        "ID": 2
    },
    "剑侠客": {
        "染色方案": 2,
        "性别": "男",
        "武器": [
            "刀",
            "剑"
        ],
        "种族": "人",
        "门派": [
            "大唐官府",
            "化生寺",
            "方寸山",
            "神木林"
        ],
        "模型": "剑侠客",
        "ID": 5
    },
    "巫蛮儿": {
        "染色方案": 201,
        "性别": "女",
        "武器": [
            "宝珠",
            "法杖"
        ],
        "种族": "人",
        "门派": [
            "大唐官府",
            "女儿村",
            "方寸山",
            "神木林"
        ],
        "模型": "巫蛮儿",
        "ID": 3
    }
};

export const characters_level_exp = [
    40, 110, 237, 450, 779, 1252, 1898, 2745, 3822, 5159, 6784, 8726, 11013, 13674, 16739, 20236, 24194, 28641, 33606, 39119, 45208,
    51902, 55229, 67218, 75899, 85300, 95450, 106377, 118110, 130679, 144112, 158438, 173685, 189882, 207059, 225244, 244466, 264753,
    286134, 308639, 332296, 357134, 383181, 410466, 439019, 468868, 500042, 532569, 566478, 601799, 638560, 676790, 716517, 757770,
    800579, 844972, 890978, 938625, 987942, 1038959, 1091704, 1146206, 1202493, 1260594, 1320539, 1382356, 1446074, 1511721, 1579326,
    1648919, 1720528, 1794182, 1869909, 1947738, 2027699, 2109820, 2194130, 2280657, 2369431, 2460479, 2553832, 2649518, 2747565,
    2848003, 2950859, 3056164, 3163946, 3274233, 3387055, 3502439, 3620416, 3741014, 3864261, 3990187, 4118819, 4250188, 4384322,
    4521249, 4660999, 4803599, 4998571, 5199419, 5406260, 5619213, 5838397, 6063933, 6295941, 6534544, 6779867, 7032035, 7291172,
    7557407, 7830869, 8111686, 8399990, 8695912, 8999586, 9311145, 9630726, 9958463, 10294496, 10638964, 10992005, 11353761, 11724374,
    12103988, 12492748, 12890799, 13298287, 13715362, 14142172, 14578867, 15025600, 15482522, 15949788, 16427552, 16915970, 17415202,
    17925402, 18446732, 18979354, 19523428, 20079116, 20646584, 21225998, 43635044, 44842648, 46075148, 47332886, 48616200, 74888148,
    76891401, 78934581, 81018219, 83142835, 85308969, 87977421, 89767944, 92061870, 146148764, 150094780, 154147340, 158309318,
    162583669, 166973428, 171481711, 176111717, 180866734, 185780135, 240602904, 533679362, 819407100, 1118169947, 1430306664,
    1756161225, 2096082853
];

/**
 * 计算等级最大经验
 * @param type 角色传1 
 * @param level 等级
 * @returns 
 */
export function get_characters_level_exp(level) {
    let max_exp = characters_level_exp[level-1];
    if (max_exp === undefined || max_exp === null) {
        return 2096082853;
    }
    return max_exp;
}

/**
 * 获取一个新的角色数据
 * @param {*} characters_type 模型
 * @param {*} characters_color 染色
 * @returns 
 */
export function get_init_characters_data(characters_type, characters_color) {

    //根据模型数据取配置信息
    let characters_conf = characters_enum_data[characters_type];

    let characters_data = {
        "id": 0,
        "新号": 1,
        "等级": 1,
        "性别": characters_conf["性别"],
        "ip": "",
        "模型": characters_type,
        "队标特效": "无",
        "储备": 100000,
        "银子": 100000,
        "存银": 0,
        "仙玉": 0,
        "点卡": 0,
        "出生日期": Math.floor(Date.now() / 1000),
        "离线时间": Math.floor(Date.now() / 1000),
        "靓号": { "ID": 0, "类型": 0, "时间": 0 },
        "门贡": 0,
        "储备灵气": 0,
        "剑会积分": 0,
        "防御": 0,
        "命中": 0,
        "速度": 0,
        "灵力": 0,
        "躲避": 0,
        "魔法": 0,
        "气血": 0,
        "伤害": 0,
        "最大气血": 0,
        "副本积分": 0,
        "上次退出": 0,
        "气血上限": 0,
        "最大魔法": 0,
        "潜力": 5,
        "人气": 700,
        "活力": 100,
        "最大活力": 100,
        "体力": 100,
        "最大体力": 100,
        "活跃度": 0,
        "门派": "无门派",
        "活动积分": 0,
        "当前经验": 10,
        "愤怒": 0,
        "洗点次数": 0,
        "通天塔数量": 0,
        "法伤": 16,
        "造化": 0,
        "武器伤害": 0,
        "月饼": 0,
        "套装激活": 0,
        "新号创建": 1,
        "官职点": 0,
        "战斗开关": 0,
        "BG": 0,
        "发言特效": 0,
        "封印命中等级": 0,
        "召唤兽携带上限": 8,
        "最大经验": get_characters_level_exp(1),
        "称谓": [],
        "当前称谓": "",
        "阵法": { "普通": 1 },
        "坐骑": null,
        "快捷技能": [],
        "行囊": [],
        "人物技能": {},
        "装备": [],
        "灵饰": [],
        "临时包裹": [],
        "子女列表": [],
        "坐骑列表": [],
        "道具": [],
        "套装": {},
        "灵宝佩戴": [],
        "法宝佩戴": [],
        "特殊技能": {},
        "法宝": [],
        "召唤兽": [],
        "额外法宝等级": {},
        "师门技能": {},
        "技能属性" : { "伤害": 0, "灵力": 0, "防御": 0, "命中": 0, "速度": 0, "气血": 0, "魔法": 0, "治疗能力": 0, "暗器防御": 0, "躲避": 0 },
        "锦衣": [],
        "额外技能等级": {},
        "安卓快捷施法": {},
        "摊位数据": {},
        "收购数据": {},
        "灵宝": [],
        "奇经八脉": {},
        "任务": {},
        "符石技能效果": {},
        "任务包裹": [],
        "剧情技能": {},
        "造型": characters_conf["模型"],
        "地图数据": { "编号": 1003, "x": 20, "y": 25, "方向": 0 },
        "种族": characters_conf["种族"],
        "可选门派": characters_conf["门派"],
        "武器数据": { "名称": "", "子类": "", "等级": 0 },
        "染色组": [Math.ceil(characters_color), Math.ceil(characters_color), Math.ceil(characters_color)],
        "染色方案": characters_conf["染色方案"],
        "历劫": { "飞升": false, "渡劫": false, "化圣": false },
        "可持有武器": characters_conf["武器"],
        "宠物": {},
        "套装名称": "无",
        "剧情": { "主线": 1, "编号": 19, "地图": 1003, "进度": 1, "附加": {} },
        "成长礼包": { "礼包一": false, "礼包二": false, "礼包三": false, "礼包四": false, "礼包五": false },
        "附加潜力": { "潜能果": 0 },
        "玄灵珠": { "类型": "回春", "破军": 0, "回春": 0, "空灵": 0, "噬魂": 0 },
        "体质": init_attribute[characters_conf["种族"]][0],
        "魔力": init_attribute[characters_conf["种族"]][1],
        "力量": init_attribute[characters_conf["种族"]][2],
        "耐力": init_attribute[characters_conf["种族"]][3],
        "敏捷": init_attribute[characters_conf["种族"]][4],
        "辅助技能": [{ "等级": 0, "名称": "强身术", "学会": false }, { "等级": 0, "名称": "冥想", "学会": false }, { "等级": 0, "名称": "强壮", "学会": false }, { "等级": 0, "名称": "暗器技巧", "学会": false }, { "等级": 0, "名称": "中药医理", "学会": false }, { "等级": 0, "名称": "烹饪技巧", "学会": false }, { "等级": 0, "名称": "打造技巧", "学会": false }, { "等级": 0, "名称": "裁缝技巧", "学会": false }, { "等级": 0, "名称": "炼金术", "学会": false }, { "等级": 0, "名称": "神速", "学会": false }, { "等级": 0, "名称": "养生之道", "学会": false }, { "等级": 0, "名称": "健身术", "学会": false }, { "等级": 0, "名称": "熔炼技巧", "学会": false }, { "等级": 0, "名称": "追捕技巧", "学会": false }, { "等级": 0, "名称": "逃离技巧", "学会": false }, { "等级": 0, "名称": "巧匠之术", "学会": false }, { "等级": 0, "名称": "灵石技巧", "学会": false }, { "等级": 0, "名称": "淬灵之术", "学会": false }],
        "秘制食谱": { "食谱": {}, "材料": 0 },
        "运镖数据": { "间隔": 0, "总次数": 0, "次数": 0 },
        "好友数据": { "临时": [], "黑名单": [], "最近": [], "好友": [] },
        "月卡": { "生效": false, "到期时间": 0 },
        "杜少海数据": { "间隔": 0, "次数": 0 },
        "日志编号": 1,
        "姻缘": { "婚姻": false },
        "修业": { "一": "无", "开启": false, "二": "无", "组合": "无", "等级": 0, "三": "无", "四": "无", "五": "无" },
        "系统设置": { "连点模式": false, "显示变身卡造型": true, "音效开启": true, "音乐音量": 80, "音效音量": 80, "显示锦衣光环足迹": true, "显示坐骑": true, "允许查看装备": true, "音乐开启": true },
        "QYD": { "额外乾元丹": 0, "可换乾元丹": 0, "已用乾元丹": 0, "可用乾元丹": 0, "已换乾元丹": 0 },
        "师门数据": { "间隔": 0, "次数": 0 },
        "十八路妖王": { "黄风怪": 1 },
        "加点方案": [{ "潜力": 0, "敏捷": 0, "体质": 0, "魔力": 0, "力量": 0, "耐力": 0 }],
        "剧情点": { "当前": 0, "总额": 0 },
        "BPMC": "无帮派",
        "BPID": 0,
        "强化技能": [{ "等级": 0, "名称": "气血强化", "学会": false }, { "等级": 0, "名称": "伤害强化", "学会": false }, { "等级": 0, "名称": "防御强化", "学会": false }, { "等级": 0, "名称": "法伤强化", "学会": false }, { "等级": 0, "名称": "法防强化", "学会": false }, { "等级": 0, "名称": "治疗强化", "学会": false }, { "等级": 0, "名称": "固伤强化", "学会": false }],
        "修炼": { "当前": "攻击修炼", "防御修炼": [0, 0, 0], "抗法修炼": [0, 0, 0], "法术修炼": [0, 0, 0], "猎术修炼": [0, 0, 0], "攻击修炼": [0, 0, 0] },
        "bb修炼": { "防御控制力": [0, 0, 0], "攻击控制力": [0, 0, 0], "当前": "攻击控制力", "抗法控制力": [0, 0, 0], "法术控制力": [0, 0, 0] },
        "队伍": 0,
        "队长": false,
        "采矿数据": {
            "总计": 0,
            "矿业声望": 0
        },
        "飞行中": false,
        "招式特效":{}
    };
    return characters_data;
}

